{* Smarty *}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>{$larch_name}: Login</title>
  <link rel="stylesheet" href="styles/main.css" type="text/css"/>
  <meta http-equiv="Content-Script-Type" content="text/javascript"/>
  <noscript>
    <!-- FIXME: This feels like a kluge, and refresh is deprecated by W3C. -->
    <!-- FIXME: Maybe have some PHP magic return a 303 See Other instead? -->
    <meta http-equiv="refresh" content="0;url=jsdisabled.php"/>
  </noscript>
  <script type="text/javascript" src="js/jquery.js"/></script>
  <script>
{literal}
    // <![CDATA[
    $(document).ready(function() {
      // When there’s an error message displayed on this page, the reset button
      // reloads the page and thus clears the message. Otherwise it does an
      // ordinary form reset. The other option is to hide it, but that seems
      // dishonest somehow.
      $(":reset").bind("click", function() {
        if ($("p").hasClass("errmsg")) {
          window.location.reload();
        }
      });
    });
    // ]]>
{/literal}
  </script>
</head>
<body>
  <h1 class="title">{$larch_name}</h1>
  <h2 class="subtitle">{$larch_name_subtitle}</h2>

{if (isset($error) && ($error != ""))}
  {$error}
{/if}
  <form action="{$smarty.server.PHP_SELF}" method="post">
    <table class="login-table">
      <caption class="login-caption">Please log in</caption>
      <tbody>
        <tr>
          <td><label for="username">Username:</label></td>
          <td>
            <input type="text" name="username" id="username" tabindex="1"/>
          </td>
        </tr>
        <tr>
          <td><label for="password">Password:</label></td>
          <td>
            <input type="password" name="password" id="password" tabindex="2"/>
          </td>
        </tr>
        <tr>
          <td><input type="submit" value="Enter" tabindex="3"/></td>
          <td><input type="reset" value="Reset" tabindex="4"/></td>
        </tr>
      </tbody>
    </table>
  </form>
{include file='footer.tpl'}
</body>
</html>
